<template xmlns:v-clipboard="http://www.w3.org/1999/xhtml">
  <div>
    <div v-if="!isApp">
      <img style="width: 30%" :src="projectInfo.cover != ''?projectInfo.cover:imgUrl"/>
      <div class="appClass">
        <div class="title">
          {{projectInfo.projectName}}
        </div>
        <div class="appLabel">
          <div class="grayColor">需要人数</div>
          <div class="split"></div>
          <div>{{projectInfo.recruiting}}人</div>
        </div>
        <div class="appLabel">
          <div class="grayColor">项目地点</div>
          <div class="split"></div>
          <div>{{projectInfo.projectAddress}}</div>
        </div>
        <div class="appLabel">
          <div class="grayColor">创建时间</div>
          <div class="split"></div>
          <div>{{projectInfo.createTime}}</div>
        </div>
        <div class="appLabel">
          <div class="grayColor">报名时间</div>
          <div class="split"></div>
          <div>{{projectInfo.projectStartDate}}至{{projectInfo.projectEndDate}}</div>
        </div>
        <div class="body grayColor">
          <div class="text1">项目简介</div>
          <div class="text2">{{projectInfo.recruitingContent}}</div>
        </div>
        <div class="qrCode">
          <div>微信扫码下方二维码获取更多信息</div>
          <img style="width: 40%" :src="projectInfo.code_img"/>
        </div>
      </div>
    </div>
    <div v-if="isApp">
      <img style="width: 100%" :src="projectInfo.cover != ''?projectInfo.cover:imgUrl"/>
      <div class="appClass">
        <div class="title">
          {{projectInfo.projectName}}
        </div>
        <div class="appLabel">
          <div class="grayColor">需要人数</div>
          <div class="split"></div>
          <div>{{projectInfo.recruiting}}人</div>
        </div>
        <div class="appLabel">
          <div class="grayColor">项目地点</div>
          <div class="split"></div>
          <div>{{projectInfo.projectAddress}}</div>
        </div>
        <div class="appLabel">
          <div class="grayColor">创建时间</div>
          <div class="split"></div>
          <div>{{projectInfo.createTime}}</div>
        </div>
        <div class="appLabel">
          <div class="grayColor">报名时间</div>
          <div class="split"></div>
          <div>{{projectInfo.projectStartDate}}至{{projectInfo.projectEndDate}}</div>
        </div>
        <div class="body grayColor">
          <div class="text1">项目简介</div>
          <div class="text2">{{projectInfo.recruitingContent}}</div>
        </div>
        <div class="qrCode">
          <div>微信扫码下方二维码获取更多信息</div>
          <img style="width: 60%" :src="projectInfo.code_img"/>
        </div>
      </div>

    </div>
  </div>
</template>

<script>
  import ElDialog from "../../../node_modules/element-ui/packages/dialog/src/component";
  export default {
    components: {ElDialog},
    data() {
      return {
        isApp: false,
        imgUrl: require('../../assets/icon_logo.png'),
        projectInfo: {}
      };
    },
    mounted() {
      this.isApp = this.isMobilePhone();
      this.getProjectDetail();
    },
    methods: {
      isMobilePhone() {
        if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) {
          return true;
        } else {
          return false;
        }
      },
      /**
       * 获取项目详情
       */
      getProjectDetail() {
        let self = this;
        let obj = {
          projectID: this.$route.query.projectID,
        };
        self.$fetch("/Category/getProjectInfo", obj).then(res => {
          if (res.code === "200") {
            self.projectInfo = res.data.projectInfo;
          } else {
            self.$message.error(res.message);
          }
        });
      }
    }
  };
</script>

<style scoped lang="less">
  .myProject {
    width: 80%;
    margin: auto;
  }

  .nameList_phone {
    width: 100%;
    display: flex;
    flex-direction: column;
    font-size: 12px;
    .head {
      height: auto;
      padding: 10px;
      display: flex;
      background: #212121;
      flex-direction: row;
      align-items: center;

      justify-content: space-between;
    }
  }

  .appClass {
    width: 96%;
    padding: 2%;
    display: flex;
    flex-direction: column;
    .nameList {
      display: flex;
      flex-display: row;
      align-items: center;
      margin-top: 10px;
    }
    .appLabel {
      display: flex;
      width: 100%;
      flex-direction: row;
      align-items: center;
      padding: 4px 0px;
      justify-content: space-between;
    }
    .split {
      height: 1px;
      border: none;
      border-top: 1px dashed #bcbcbc;
      flex: 1;
      margin: auto;
    }
    img {
      width: 100%;
      height: auto;
    }
    .title {
      margin-top: 10px;
      font-weight: bold;
      font-size: 22px;
      margin-bottom: 20px;
    }
    .grayColor {
      color: gray;
    }
    .body {
      margin-top: 20px;
    }
    .text1 {
      margin-bottom: 10px;
    }
    .text2 {
      color: black;
    }
  }

  .qrCode {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 30px;
    color: #b3302e;
  }


</style>
